import scrapy


class TcSpider(scrapy.Spider):
    name = "tc"
    allowed_domains = ["gaoan.58.com"]
    start_urls = ["https://gaoan.58.com/quanzhizhaopin/?key=%E5%90%8E%E7%AB%AF%E5%BC%80%E5%8F%91&classpolicy=strategy%2Cuuid_7653521a7f6b468c93d36f3eb3a3c89c%2Cdisplocalid_5712%2Cfrom_674%2Cto_jump%2Ctradeline_job%2Cclassify_D&search_uuid=7653521a7f6b468c93d36f3eb3a3c89c&final=1"]

    def parse(self, response):
        # print(response.text) # 输出内容
        label = response.xpath('//td/label/text()')
        # print(label) # 获取对象标签
        # print(label.extract())# 获取标签中的数据(列表)
        print(label.extract_first())# 获取标签中的数据(列表中的第一个对象)
